﻿<!DOCTYPE html>
<html>
<!-- 安全经验分享库-编辑 -->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

</head>

<body>
    <div id="app" class="popupW50" v-cloak>
        <iframe :src="myurl" style="height:500px;width:100%"></iframe>

    </div>
    <script type="text/javascript">
        var uploadText = "请选择上传文件";
        var app = new Vue({
            el: '#app',
            data: {
                myurl : '/static/pdfjs/web/viewer.html?file2=http://localhost:8080/api/file/DownLoad?id=',
                value1: '',
                // picked : '1',
                //父业传参
                id: '',
                //获取下拉菜单frequency
                frequency: [],
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    Name: '',
                    Dateofaddition: '',
                    Conferencecontent: '',
                    fileItem: uploadText

                },
                //表单验证
                rules: {
                    Name: [
                        verification.NotNull,
                    ],
                    Dateofaddition: [
                        verification.NotNull,
                    ],
                    Conferencecontent: [
                        verification.NotNull,
                    ],


                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },

                handleRemove: function (file) {
                    console.log(file);
                },
                handlePreview: function (file) {
                    console.log(file.name);
                    window.open(file.url)
                },
                //上传附件文件的校验
                CoursewareUploadbeforeupload: function (file) {
                    var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1)
                    //将附件名赋值到label上
                    this.Form.fileItem = file.name;
                    const extension = testmsg === 'doc'
                    const extension2 = testmsg === 'pdf'
                    const isLt10M = file.size / 1024 / 1024 < 10
                    if (!extension && !extension2) {
                        this.$message({
                            message: '上传文件只能是 doc、pdf格式!',
                            type: 'warning'
                        });
                    }
                    if (!isLt10M) {
                        this.$message({
                            message: '上传文件大小不能超过 10MB!',
                            type: 'warning'
                        });
                    }
                    if (extension || extension2 && isLt10M)
                        submitUpload(this, 'upload')
                    return extension || extension2 && isLt10M
                },
                btnAttachmentUpload: function () {
                    //若更换文件则将文件名字更换触发条件--先删除上一个文件,后添加一个文件
                    if (this.fileAttachmentUpload != uploadText) {
                        this.$refs.Attachmentupload.clearFiles();
                        this.fileAttachmentUpload = file.name;
                    }
                    else {

                    }
                    this.$refs.Attachmentupload.submit();
                },
                //PDF上传成功
                pdfok: function () {
                    this.$message({
                        message: 'PDF上传成功',
                        type: 'success'
                    });
                },
                //提交数据
                onSubmitForm: function (formName) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/SecurityExperienceSharingLibrary/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                getData: function () {
                    getData(this, '/api/SecurityExperienceSharingLibrary/get?id=' + this.id);
                    this.Form.frequency = this.Form.frequency + "";
                },
            },
            mounted: function () {

                this.id = getUrlParam("id");
                this.myurl = this.myurl + this.id;
                //this.getData();
                //获取下拉菜单内容
                //this.frequency = getDicData('56');
                //初始化数据
                // this.GetPageData(1);
                //列表高度自适应
                //tablehigh(this);

            },

        });
    </script>
</body>

</html>